﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2006" 
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
	x:Class="SmartCA.Presentation.Views.SubmittalView"
	xmlns:presentation="clr-namespace:SmartCA.Presentation.Views"
	Title="Submittal Routing Transmittals"
	x:Name="submittalTransmittalsWindow"
	Width="800" Height="600" Background="{StaticResource FormBackgroundBrush}">
	
  <Grid>
  
	<Grid.RowDefinitions>
	  <RowDefinition Height="Auto" />
	  <RowDefinition />
	  <RowDefinition Height="Auto" />
	</Grid.RowDefinitions>
	<Grid.ColumnDefinitions>
	  <ColumnDefinition Width="1*" />
	  <ColumnDefinition Width="2*" />
	</Grid.ColumnDefinitions>
	
	<Label Style="{StaticResource headerLabelStyle}" Margin="10" Grid.Row="0" Grid.Column="0">Submittals</Label>
	<Label Style="{StaticResource headerLabelStyle}" Margin="0,10,10,10" Grid.Row="0" Grid.Column="1">Selected Submittal</Label>
	
	<ListBox Margin="10,0,10,10" Grid.Row="1" Grid.Column="0" 
		IsSynchronizedWithCurrentItem="True" 
		SelectedItem="{Binding Path=CurrentEntity}"
		ItemsSource="{Binding Path=EntitiesView}"
		DisplayMemberPath="Number"/>
		
	<Border BorderBrush="Black" BorderThickness="1" Margin="0,0,10,10" Grid.Row="1" Grid.Column="1">
		<ScrollViewer>
			<Grid>
			
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
					<RowDefinition Height="Auto" />
				</Grid.RowDefinitions>
				
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="Auto" />
					<ColumnDefinition Width="Auto" />
				</Grid.ColumnDefinitions>
				
				<Label Grid.Row="0" Grid.Column="0" Content="Submittal Number:" 
					Style="{StaticResource baseLabelStyle}"/>
				<StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="1">
					<ComboBox SelectedItem="{Binding Path=CurrentEntity.SpecSection}"
						IsSynchronizedWithCurrentItem="True"
						DisplayMemberPath="Number"
						ItemsSource="{Binding Path=SpecificationSections}">				
					</ComboBox>
					<TextBox 
						Text="{Binding Path=CurrentEntity.SpecSectionPrimaryIndex}"/>
					<TextBox 
						Text="{Binding Path=CurrentEntity.SpecSectionSecondaryIndex}"/>
				</StackPanel>
				
				<Label Grid.Row="1" Grid.Column="0" Content="To:"
					Style="{StaticResource baseLabelStyle}"/>
				<ComboBox Grid.Row="1" Grid.Column="1"
					SelectedItem="{Binding Path=CurrentEntity.To}"
					IsSynchronizedWithCurrentItem="True"
					ItemsSource="{Binding Path=ToList}">
					<ComboBox.ItemTemplate>
						<DataTemplate>
							<Grid>
								<Grid.ColumnDefinitions>
									<ColumnDefinition />
									<ColumnDefinition />
									<ColumnDefinition />
								</Grid.ColumnDefinitions>
								<TextBlock Grid.Column="0" Text="{Binding Path=Contact.FirstName}"/>
								<TextBlock Grid.Column="1" Text=" " />
								<TextBlock Grid.Column="2" Text="{Binding Path=Contact.LastName}"/>
							</Grid>
						</DataTemplate>
					</ComboBox.ItemTemplate>					
				</ComboBox>
				
				<Label Grid.Row="2" Grid.Column="0" Content="Transmittal Date:"
					Style="{StaticResource baseLabelStyle}"/>
				<DatePicker Grid.Row="2" Grid.Column="1" 
					SelectedDate="{Binding Path=CurrentEntity.TransmittalDate}" />
				
				<Label Grid.Row="3" Grid.Column="0" Content="From:"
					Style="{StaticResource baseLabelStyle}"/>
				<ComboBox Grid.Row="3" Grid.Column="1"
					SelectedItem="{Binding Path=CurrentEntity.From}"
					IsSynchronizedWithCurrentItem="True"
					ItemsSource="{Binding Path=FromList}">	
					<ComboBox.ItemTemplate>
						<DataTemplate>
							<Grid>
								<Grid.ColumnDefinitions>
									<ColumnDefinition />
									<ColumnDefinition />
									<ColumnDefinition />
								</Grid.ColumnDefinitions>
								<TextBlock Grid.Column="0" Text="{Binding Path=FirstName}"/>
								<TextBlock Grid.Column="1" Text=" " />
								<TextBlock Grid.Column="2" Text="{Binding Path=LastName}"/>
							</Grid>
						</DataTemplate>
					</ComboBox.ItemTemplate>				
				</ComboBox>
				
				<Label Grid.Row="4" Grid.Column="0" Content="Delivery Method:"
					Style="{StaticResource baseLabelStyle}"/>
				<ListBox Grid.Row="4" Grid.Column="1" 
					SelectedItem="{Binding Path=CurrentEntity.DeliveryMethod}" 
					IsSynchronizedWithCurrentItem="True" 
					ItemsSource="{Binding Path=DeliveryMethods}"
					SelectionMode="Multiple"/>
													
				<Label Grid.Row="5" Grid.Column="0" Content="Other Delivery Method:" 
					Style="{StaticResource baseLabelStyle}"/>
				<TextBox Grid.Row="5" Grid.Column="1" 
					Text="{Binding Path=CurrentEntity.OtherDeliveryMethod}"/>
								
				<Label Grid.Row="6" Grid.Column="0" Content="Phase No.:" 
					Style="{StaticResource baseLabelStyle}"/>
				<TextBox Grid.Row="6" Grid.Column="1" 
					Text="{Binding Path=CurrentEntity.PhaseNumber}"/>
				
				<Label Grid.Row="7" Grid.Column="0" Content="Reimbursable:" 
					Style="{StaticResource baseLabelStyle}"/>
				<CheckBox Grid.Row="7" Grid.Column="1" 
					IsChecked="{Binding Path=CurrentEntity.Reimbursable}"/>
					
				<Label Content="CC:" Grid.Row="8" Grid.Column="0"
							Style="{StaticResource baseLabelStyle}"/>
					
				<Border BorderBrush="Black" Padding="1" BorderThickness="1" 
					Grid.Row="8" Grid.Column="1">
					<StackPanel Orientation="Horizontal">
						<Label Content="Final:  " Style="{StaticResource baseLabelStyle}"/>
						<CheckBox IsChecked="{Binding Path=CurrentEntity.Final}" />
						<presentation:CopyToList
								DataContext="{Binding Path=MutableCopyToList}"/>
					</StackPanel>
				</Border>
				
				<Label Grid.Row="9" Grid.Column="0" Content=""
					Style="{StaticResource baseLabelStyle}"/>
				<presentation:TrackingItems Grid.Row="9" Grid.Column="1" 
					DataContext="{Binding Path=TrackingItems}"/>
					
				<Label Grid.Row="10" Grid.Column="0" Content=""
					Style="{StaticResource baseLabelStyle}"/>
				<presentation:RoutingItems Grid.Row="10" Grid.Column="1" 
					DataContext="{Binding Path=RoutingItemsViewModel.RoutingItems}"/>
				
				<Label Grid.Row="11" Grid.Column="0" Content="Remarks:" 
					Style="{StaticResource baseLabelStyle}"/>
				<TextBox Grid.Row="11" Grid.Column="1" 
					Text="{Binding Path=CurrentEntity.Remarks}"/>
					
				<Label Grid.Row="12" Grid.Column="0" Content="Action:" 
					Style="{StaticResource baseLabelStyle}"/>
				<ComboBox Grid.Row="12" Grid.Column="1"
					ItemsSource="{Binding Path=TrackingStatusValues}"
					SelectedItem="{Binding Path=CurrentEntity.Action}"
					IsSynchronizedWithCurrentItem="True">				
				</ComboBox>
					
				<Label Grid.Row="13" Grid.Column="0" Content="Status:" 
					Style="{StaticResource baseLabelStyle}"/>
				<ComboBox Grid.Row="13" Grid.Column="1"
					ItemsSource="{Binding Path=ItemStatuses}"
					DisplayMemberPath="Status"
					SelectedItem="{Binding Path=CurrentEntity.Status}">				
				</ComboBox>
				
				<Label Grid.Row="14" Grid.Column="0" Content="Date to Field:" 
					Style="{StaticResource baseLabelStyle}"/>
				<DatePicker Grid.Row="14" Grid.Column="1" 
					SelectedDate="{Binding Path=CurrentEntity.DateToField}" />
						
        </Grid>
	  </ScrollViewer>
	</Border>
	
	<Button HorizontalAlignment="Right" Margin="10,0,10,10" Grid.Row="2" Grid.Column="0" Command="{Binding Path=NewCommand}">New</Button>
	<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.Row="2" Grid.Column="1">
	  <Button Grid.Row="2" Margin="10,0,10,10" Grid.Column="0" Command="{Binding Path=SaveCommand}">Save</Button>
	  <Button Grid.Row="2" Margin="0,0,10,10" Grid.Column="0" Command="{Binding Path=CancelCommand}">Cancel</Button>
	</StackPanel>

  </Grid>
  
</Window>

